package cii_lib_graph;

import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.WindowConstants;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import cii_lib.CCII_ACCESS_PARAM;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class GParameterPanel extends javax.swing.JPanel {
	
	private static final Logger log = LoggerFactory
			.getLogger(GParameterPanel.class);
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JLabel paramName;
	private JTextField paramValue;
	private CCII_ACCESS_PARAM parameter;

	/**
	* Auto-generated main method to display this 
	* JPanel inside a new JFrame.
	*/
	public void testGUI() {
		JFrame frame = new JFrame();
		frame.getContentPane().add(this);
		frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		frame.pack();
		frame.setVisible(true);
	}
	
	public GParameterPanel(CCII_ACCESS_PARAM param) {
		super();
		parameter=param;
		initGUI();
	}
	
	public GParameterPanel() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			this.setPreferredSize(new java.awt.Dimension(203, 20));
			BoxLayout thisLayout = new BoxLayout(
				this,
				javax.swing.BoxLayout.X_AXIS);
			this.setLayout(thisLayout);
			{
				paramName = new JLabel();
				this.add(paramName);
				paramName.setText(" "+((parameter!=null)?parameter.GetItem().Name:""));
				paramName.setPreferredSize(new java.awt.Dimension(95, 15));
				paramName.setFont(new java.awt.Font("Tahoma",0,12));
			}
			{
				paramValue = new JTextField();
				this.add(paramValue);
				paramValue.setText("0");
				paramValue.setEditable(false);
				paramValue.setHorizontalAlignment(SwingConstants.RIGHT);
				paramValue.setToolTipText("Value");
			}
		} catch (Exception e) {
			log.error("", e);
		}
	}

	public CCII_ACCESS_PARAM getParameter() {
		return parameter;
	}

	public void setParameter(CCII_ACCESS_PARAM parameter) {
		this.parameter = parameter;
	}

	public JLabel getParamName() {
		return paramName;
	}

	public void setParamName(JLabel paramName) {
		this.paramName = paramName;
	}

	public JTextField getParamValue() {
		return paramValue;
	}

	public void setParamValue(JTextField paramValue) {
		this.paramValue = paramValue;
	}

}
